 $(document).ready(function($)
{
  //$.sankofavVolunteer.loadVolunteer()
  // trigger event when button is clicked
  $("#addbutton").click(function()
  {
    // add new row to table using addTableRow function
    addTableRow($("#input_table"));
 
    // prevent button redirecting to new page
    return false;
  });

addCalendar("date1");

});

var back = function() {
    window.location="window.history.back()";
}

var mouseover = function(){
    onMouseover="Take you to this page";
}



var getCal = function() {
    var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        cal1,
        over_cal = false,
        cur_field = '';

}

var count = 1;


// function to add a new row to a table by cloning the last row and
  // incrementing the name and id values by 1 to make them unique
  var addTableRow = function(table)
  {

    // clone the last row in the table
    var $tr = $('#input_table').find("tbody tr:last").clone();
    $tr.find("input").attr("value","");
 
    // get the name attribute for the input and select fields
    $tr.find("input,select").attr("name", function()
    {
      // break the field name and it's number into two parts
      var parts = this.id.match(/(\D+)(\d+)$/);
 
      // create a unique name for the new field by incrementing
      // the number for the previous field by 1
      return parts[1] + ++parts[2];
    // repeat for id attributes
    });

     $tr.find("input,select").attr("id", function()
     {
       var parts = this.id.match(/(\D+)(\d+)$/);
       return parts[1] + ++parts[2];
     });
         
    // append the new row to the table
    $(table).find("tbody tr:last").after($tr);

    count++;
    addCalendar("date" + count.toString());
    


  };

var addCalendar = function(mytarget){
    new JsDatePick({
      useMode:2,
      target:mytarget,
      dateFormat:"%m/%d/%Y",
      imgPath:"img/",
      cellColorScheme:"armygreen",
      /*selectedDate:{        This is an example of what the full configuration offers.
        day:5,            For full documentation about these settings please see the full version of the code.
        month:9,
        year:2006
      },
      yearsRange:[1978,2020],
      limitToToday:false,
      cellColorScheme:"beige",
      dateFormat:"%m-%d-%Y",
      imgPath:"img/",
      weekStartDay:1*/
    });
  };

$('#submitbutton').click=(function(){
        console.log("clicked");
        for(i=0;i<count;i++)
          {"sankofaVolunteer.addVolunteers(i)"};
      });

    
